<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>评论</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  </head>
  <body>
    <div id="app">
      <textarea
        id=""
        cols="30"
        rows="10"
        v-model="msg"
        @keyup.enter="submit"
      ></textarea>
      <button @click="submit">发布评论</button>
      <table border="1" cellpadding="10" cellspacing="0">
        <tr>
          <th>游客</th>
          <th>评论</th>
          <th>点赞数</th>
          <th>发布日期</th>
          <th colspan="3">操作</th>
        </tr>

        <tr v-for="(item,index) in list">
          <td>{{item.name}}</td>
          <td>{{item.common}}</td>
          <td>{{item.good}}</td>
          <td>{{item.date}}</td>
          <td>
            <button @click="item.good++">点赞</button>
          </td>
          <td>
            <button @click="list.unshift(...list.splice(index,1))">置顶</button>
          </td>
          <td>
            <button @click="list.splice(index,1)">删除</button>
          </td>
        </tr>
      </table>
    </div>
  </body>
</html>
